<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">

    <div class="layui-card-body">

        <div class="layui-form-item">
            <label class="layui-form-label label-required-next">上级分类</label>
            <div class="layui-input-block">
                <select name='parent_id' class='layui-select' lay-search>
                    {foreach $menus as $menu}
                    {eq name='menu.id' value='$vo.parent_id|default=0'}
                    <option selected value='{$menu.id}'>{$menu.spl|raw}{$menu.title}</option>
                    {else}
                    <option value='{$menu.id}'>{$menu.spl|raw}{$menu.title}</option>
                    {/eq}
                    {/foreach}
                </select>
                <p class="help-block">必选，请选择上级菜单或顶级菜单（目前最多支持三级菜单）</p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">分类名称</label>
            <div class="layui-input-block">
                <input name="title" value='{$vo.title|default=""}' required placeholder="请输入分类名称" class="layui-input">
                <p class="help-block">必填，请填写分类名称（如：系统管理），建议字符不要太长，一般4-6个汉字</p>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">分类属性</label>
            <div class="layui-input-block">
                <?php if(!isset($vo['type'])){ $vo['type'] = "info"; }; ?>
                {foreach $types as $key=>$vo2}
                    <input name="type" value="{$key}" type="radio" {if condition="$vo['type'] eq $key"}checked{/if} title="{$vo2}">
                {/foreach}
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">分类描述</label>
            <div class="layui-input-block">
                <input name="memo" value='{$vo.memo|default=""}'  placeholder="请输入分类描述" class="layui-input">
                <p class="help-block">选填，请填写分类描述（如：系统管理），建议字符不要太长，一般10-30个汉字</p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">显示序号</label>
            <div class="layui-input-block">
                <input name="sort" value='{$vo.sort|default="1"}'  placeholder="请输入显示序号" class="layui-input">
                <p class="help-block">选填，请填写分类的显示序号</p>
            </div>
        </div>

    </div>

    <div class="hr-line-dashed"></div>
    {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}

    <div class="layui-form-item text-center">
        <button class="layui-btn" type='submit'>保存数据</button>
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
    </div>

</form>

{block name='script'}
<script>
    require(['jquery.autocompleter'], function () {
        layui.form.render();
        $('input[name=url]').autocompleter({
            limit: 6, highlightMatches: true, template: '{{ label }} <span> {{ title }} </span>', source: (function (subjects, data) {
                for (var i in subjects) data.push({value: subjects[i].node, label: subjects[i].node, title: subjects[i].title});
                return data;
            })(JSON.parse('{$nodes|raw|json_encode}'), [])
        });
    });
</script>
{/block}
